// eslint-disable-next-line
import {
  UserLayout,
  BasicLayout,
  BlankLayout
} from '@/layouts'
// import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
export const asyncRouterMap = [{
    //path: '/',
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: {
      title: 'menu.home'
    },
    redirect: '/user/login',
    children: [
      // dashboard
      {
        path: '/statistics',
        name: 'statistics',
        redirect: '/statistics-msg',
        component: RouteView,
        meta: {
          title: 'menu.dashboard',
          keepAlive: true,
          icon: 'line-chart',
          permission: ['statistics']
        },
        children: [{
            path: '/statistics-msg',
            name: 'statistics-msg',
            component: () => import('@/views/dashboard/msgAnalysis'),
            meta: {
              title: '短信统计',
              keepAlive: false,
              permission: ['statistics']
            }
          },
          {
            path: '/statistics-finance',
            name: 'statistics-finance',
            component: () => import('@/views/dashboard/financeAnalysis'),
            meta: {
              title: '资产统计',
              keepAlive: false,
              permission: ['statistics']
            },
          },
          {
            path: '/statistics-service',
            name: 'statistics-service',
            component: () => import('@/views/dashboard/serviceAnalysis'),
            meta: {
              title: '客服统计',
              keepAlive: false,
              permission: ['statistics']
            },
          },
          
        ]
      },
      // 用户管理
      {
        path: '/user-controller',
        name: 'user-controller',
        component: RouteView,
        redirect: '/user-list',
        meta: {
          title: '用户管理',
          icon: 'user-add',
          permission: ['user']
        },
        children: [{
            path: '/user-list/:pageNo([1-9]\\d*)?',
            name: 'user-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/userList/UserList'),
            meta: {
              title: '用户列表',
              keepAlive: true,
              permission: ['user']
            },
            children: []
          },
          {
            path: '/user-login-list/:pageNo([1-9]\\d*)?',
            name: 'user-login-list',
            component: () => import('@/views/userList/UserLogList'),
            meta: {
              title: '用户登录记录',
              keepAlive: true,
              permission: ['user']
            }
          },
        ]
      },
      // 短信管理

      {
        path: '/cloud-sms',
        name: 'sms-controller',
        component: RouteView,
        redirect: '/sms-list',
        meta: {
          title: '云信管理',
          icon: 'transaction',
          permission: ['cloud']
        },
        children: [{
            path: '/sms-list/:pageNo([1-9]\\d*)?',
            name: 'sms-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/Msg'),
            meta: {
              title: '短信记录',
              keepAlive: true,
              permission: ['cloud']
            }
          },
          {
            path: '/timing-sms-list/:pageNo([1-9]\\d*)?',
            name: 'timing-sms-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/TimingSmg'),
            meta: {
              title: '定时短信记录',
              keepAlive: true,
              permission: ['cloud']
            }
          },
          {
            path: '/smsCurtail-list/:pageNo([1-9]\\d*)?',
            name: 'smsCurtail-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/smsCurtail'),
            meta: {
              title: '用户缩减管理',
              keepAlive: true,
              permission: ['cloud']
            }
          },
          {
            path: '/signature-list/:pageNo([1-9]\\d*)?',
            name: 'signature-list',
            redirect: '/signature-list/list/',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/Signature/Index'),
            meta: {
              title: '签名管理',
              keepAlive: true,
              permission: ['cloud']
            },
            children: [{
                path: '/signature-list/list/:pageNo([1-9]\\d*)?',
                name: 'signature-list',
                component: () => import('@/views/cloud/Signature/List'),
                meta: {
                  title: '列表',
                  keepAlive: true,
                  permission: ['cloud']
                },
              },
              {
                path: '/signature-list/add',
                name: 'signature-list',
                component: () => import('@/views/cloud/Signature/Form'),
                meta: {
                  title: '新增',
                  keepAlive: true,
                  permission: ['cloud']
                },
              },
              {
                path: '/signature-list/update/:id([1-9]\\d*)?',
                name: 'signature-list',
                component: () => import('@/views/cloud/Signature/Form'),
                meta: {
                  title: '编辑',
                  keepAlive: true,
                  permission: ['cloud']
                },
              }
            ]
          },
          {
            path: '/platformTemplate-list',
            name: 'platformTemplate-list',
            redirect: '/platformTemplate-list/list/',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/PlatformTemplate/Index'),
            meta: {
              title: '模板管理',
              keepAlive: true,
              permission: ['cloud']
            },
            children: [{
                path: '/platformTemplate-list/list/:pageNo([1-9]\\d*)?',
                name: 'platformTemplate-list',
                component: () => import('@/views/cloud/PlatformTemplate/List'),
                meta: {
                  title: '列表',
                  keepAlive: true,
                  permission: ['cloud']
                },
              },
              {
                path: '/platformTemplate-list/add',
                name: 'platformTemplate-list',
                component: () => import('@/views/cloud/PlatformTemplate/Form'),
                meta: {
                  title: '新增',
                  keepAlive: true,
                  permission: ['cloud']
                },
              },
              {
                path: '/platformTemplate-list/update/:id([1-9]\\d*)?',
                name: 'platformTemplate-list',
                component: () => import('@/views/cloud/PlatformTemplate/Form'),
                meta: {
                  title: '编辑',
                  keepAlive: true,
                  permission: ['cloud']
                },
              }
            ]
          },
          {
            path: '/platform-list/:pageNo([1-9]\\d*)?',
            name: 'platform-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/Platform'),
            meta: {
              title: '短信平台列表',
              keepAlive: true,
              permission: ['cloud']
            }
          },
          {
            path: '/product-list/:pageNo([1-9]\\d*)?',
            name: 'product-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/Product'),
            meta: {
              title: '产品管理',
              keepAlive: true,
              permission: ['cloud']
            }
          },
          {
            path: '/platform-price-list/:pageNo([1-9]\\d*)?',
            name: 'platform-price-list',
            hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
            component: () => import('@/views/cloud/PlatformPrice'),
            meta: {
              title: '平台产品成本管理',
              keepAlive: true,
              permission: ['cloud']
            }
          },
        ]
      },
      {
        path: '/service-controller',
        name: 'service-controller',
        component: RouteView,
        redirect: '/service/service-log',
        meta: {
          title: '客服管理',
          icon: 'message',
          permission: ['service']
        },
        children: [{
            path: '/service/service-log/:pageNo([1-9]\\d*)?',
            name: 'service-log',
            component: () => import('@/views/Service/Log'),
            meta: {
              title: '客服记录',
              keepAlive: true,
              permission: ['service']
            }
          },
          {
            path: '/service/service-product/:pageNo([1-9]\\d*)?',
            name: 'service-product',
            component: () => import('@/views/Service/Product'),
            meta: {
              title: '推荐产品',
              keepAlive: true,
              permission: ['service']
            }
          },
          {
            path: '/service/service-setting',
            name: 'service-setting-set',
            component: () => import('@/views/Service/Set'),
            meta: {
              title: '客服设置',
              keepAlive: true,
              permission: ['service']
            }
          },
        ]
      },
      {
        path: '/setting-controller',
        name: 'setting-controller',
        component: RouteView,
        redirect: '/black-list',
        meta: {
          title: '平台管理',
          icon: 'setting',
          permission: ['setting']
        },
        children: [{
            path: '/black-list/:pageNo([1-9]\\d*)?',
            name: 'black-list',
            component: () => import('@/views/setting/Black'),
            meta: {
              title: '黑名单列表',
              keepAlive: true,
              permission: ['setting']
            }
          },
          {
            path: '/setting-set',
            name: 'setting-set',
            component: () => import('@/views/setting/Setting'),
            meta: {
              title: '平台设置',
              keepAlive: true,
              permission: ['setting']
            }
          },
        ]
      },
      // 系统设置
      {
        path: '/admin-controller',
        name: 'admin-controller',
        component: RouteView,
        redirect: '/admin-list',
        meta: {
          title: '管理员管理',
          icon: 'setting',
          permission: ['admin']
        },
        children: [{
            path: '/admin-list/:pageNo([1-9]\\d*)?',
            name: 'admin-list',
            component: () => import('@/views/admin/AdminList'),
            meta: {
              title: '管理员列表',
              keepAlive: true,
              permission: ['admin']
            }
          },
          {
            path: '/admin-role-list/:pageNo([1-9]\\d*)?',
            name: 'admin-role-list',
            component: () => import('@/views/admin/Role'),
            meta: {
              title: '角色列表',
              keepAlive: true,
              permission: ['admin']
            }
          },
          {
            path: '/admin-login-list/:pageNo([1-9]\\d*)?',
            name: 'admin-login-list',
            component: () => import('@/views/admin/AdminLogList'),
            meta: {
              title: '登录记录',
              keepAlive: true,
              permission: ['admin']
            }
          },
          {
            path: '/admin-opLog-list/:pageNo([1-9]\\d*)?',
            name: 'admin-opLog-list',
            component: () => import('@/views/admin/Operating'),
            meta: {
              title: '操作记录',
              keepAlive: true,
              permission: ['admin']
            }
          }
        ]
      },


      {
        path: '/finance',
        name: 'finance',
        component: RouteView,
        // hideChildrenInMenu:true,
        redirect: '/finance/expense',
        meta: {
          title: '财务',
          icon: 'wallet',
          permission: ['finance']
        },
        children: [{
            path: '/finance/expense',
            name: 'consume-list',
            component: () => import('@/views/finance/expense'),
            meta: {
              title: '消费明细',
              icon: 'shopping',
              keepAlive: true,
              permission: ['finance']
            },
          },
          {
            path: '/finance/recharge',
            name: 'recharge-list',
            component: () => import('@/views/finance/recharge'),
            meta: {
              title: '充值记录',
              icon: 'import',
              keepAlive: true,
              permission: ['finance']
            },
          },
        ]
      },
      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        hidden: true,
        redirect: '/exception/403',
        meta: {
          title: 'menu.exception',
          icon: 'warning',
          permission: ['exception']
        },
        children: [{
            path: '/exception/403',
            name: 'Exception403',
            component: () => import( /* webpackChunkName: "fail" */ '@/views/exception/403'),
            meta: {
              title: 'menu.exception.not-permission',
              permission: ['exception']
            }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import( /* webpackChunkName: "fail" */ '@/views/exception/404'),
            meta: {
              title: 'menu.exception.not-find',
              permission: ['exception']
            }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import( /* webpackChunkName: "fail" */ '@/views/exception/500'),
            meta: {
              title: 'menu.exception.server-error',
              permission: ['exception']
            }
          }
        ]
      },

    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export const accountMap = [{
  path: '/service/service-center',
  name: 'service-center',
  component: () => import('@/views/ServiceCenter/index'),
  meta: {
    title: '客服中心',
    hideHeader: true,
    permission: ['service']
  },
}]
/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [{
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [{
        path: 'login',
        name: 'login',
        meta: {
          title: '登录',
          keepAlive: false,
          permission: ['dashboard']
        },
        component: () => import( /* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        meta: {
          title: '注册',
          keepAlive: false,
          permission: ['dashboard']
        },
        component: () => import( /* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import( /* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import( /* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]